package jp.co.baka.html5.controller.table;

import java.util.ArrayList;
import java.util.List;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

public class FixedTable1Controller extends Controller {

    @Override
    public Navigation run() throws Exception {

        int recordNum = 300;

        FixedTable1Controller.crearCount();

        List<LineDto> dataList = new ArrayList<LineDto>();
        for (int i = 0; i < recordNum; i++) {

            LineDto line = new LineDto();
            dataList.add(line);

        }

        requestScope("dataList", dataList);

        return forward("fixedTable1.jsp");
    }

    private static int count = 1;

    private static int incrementCount() {
        return count++;
    }

    private static void crearCount() {
        count = 1;
    }

    public static class LineDto {

        private String str1;
        private String str2;
        private String str3;
        private String str4;
        private String str5;
        private String str6;
        private String str7;

        private String str8;
        private String str9;
        private String str10;
        private String str11;
        private String str12;
        private String str13;
        private String str14;
        private String str15;
        private String str16;
        private String str17;

        public LineDto() {

            this.str1 =
                Integer.toString(FixedTable1Controller.incrementCount());
            this.str2 = createRandomStr("い");
            this.str3 = createRandomStr("う");
            this.str4 = createRandomStr("え");
            this.str5 = createRandomStr("お");
            this.str6 = createRandomStr("か");
            this.str7 = createRandomStr("き");

            this.str8 = createRandomStr("い");
            this.str9 = createRandomStr("う");
            this.str10 = createRandomStr("え");
            this.str11 = createRandomStr("お");
            this.str12 = createRandomStr("か");
            this.str13 = createRandomStr("き");
            this.str14 = createRandomStr("い");
            this.str15 = createRandomStr("う");
            this.str16 = createRandomStr("え");
            this.str17 = createRandomStr("お");
        }

        public String createRandomStr(String s) {

            Double d = Math.random() * 10;
            int size = d.intValue();

            StringBuffer buf = new StringBuffer(s);
            for (int i = 0; i < size; i++) {
                buf.append(s);
            }

            return buf.toString();
        }

        public String getStr1() {
            return str1;
        }

        public void setStr1(String str1) {
            this.str1 = str1;
        }

        public String getStr2() {
            return str2;
        }

        public void setStr2(String str2) {
            this.str2 = str2;
        }

        public String getStr3() {
            return str3;
        }

        public void setStr3(String str3) {
            this.str3 = str3;
        }

        public String getStr4() {
            return str4;
        }

        public void setStr4(String str4) {
            this.str4 = str4;
        }

        public String getStr5() {
            return str5;
        }

        public void setStr5(String str5) {
            this.str5 = str5;
        }

        public String getStr6() {
            return str6;
        }

        public void setStr6(String str6) {
            this.str6 = str6;
        }

        public String getStr7() {
            return str7;
        }

        public void setStr7(String str7) {
            this.str7 = str7;
        }

        public String getStr8() {
            return str8;
        }

        public void setStr8(String str8) {
            this.str8 = str8;
        }

        public String getStr9() {
            return str9;
        }

        public void setStr9(String str9) {
            this.str9 = str9;
        }

        public String getStr10() {
            return str10;
        }

        public void setStr10(String str10) {
            this.str10 = str10;
        }

        public String getStr11() {
            return str11;
        }

        public void setStr11(String str11) {
            this.str11 = str11;
        }

        public String getStr12() {
            return str12;
        }

        public void setStr12(String str12) {
            this.str12 = str12;
        }

        public String getStr13() {
            return str13;
        }

        public void setStr13(String str13) {
            this.str13 = str13;
        }

        public String getStr14() {
            return str14;
        }

        public void setStr14(String str14) {
            this.str14 = str14;
        }

        public String getStr15() {
            return str15;
        }

        public void setStr15(String str15) {
            this.str15 = str15;
        }

        public String getStr16() {
            return str16;
        }

        public void setStr16(String str16) {
            this.str16 = str16;
        }

        public String getStr17() {
            return str17;
        }

        public void setStr17(String str17) {
            this.str17 = str17;
        }

    }

}
